package com.app.couponsharelife.ui.main.home.local

import androidx.recyclerview.widget.LinearLayoutManager
import com.app.couponsharelife.R
import com.app.couponsharelife.base.BaseActivity
import com.app.couponsharelife.ui.adapter.LocalShopAddressSelectContentAdapter
import com.app.couponsharelife.ui.listener.OnClickListener
import kotlinx.android.synthetic.main.activity_local_shops_address_select.*
import kotlinx.android.synthetic.main.common_tool_bar_layout.*

class LocalShopsAddressSelectActivity : BaseActivity() {

    override val viewLayoutId: Int get() = R.layout.activity_local_shops_address_select

    override fun initViews() {
        initToolBar()
        initRecyclerView()
    }

    private fun initToolBar() {
        ivBack.setOnClickListener { finish() }
        tvToolBarTitle.text = "选择城市"
    }

    private fun initRecyclerView() {
        mRecyclerView.layoutManager = LinearLayoutManager(this)
        mRecyclerView.adapter = LocalShopAddressSelectContentAdapter(arrayListOf(1, 2), object : OnClickListener {
            override fun click(arg1: Int, arg2: Any) {
                finish()
            }
        })

//        mRecyclerViewChar.layoutManager = LinearLayoutManager(this)
//        mRecyclerViewChar.adapter = LocalShopAddressSelectCharAdapter(object : OnClickListener {
//            override fun click(arg1: Int, arg2: Any) {
//                val position = arg1 + 2
//                if (position < (mRecyclerView.adapter as LocalShopAddressSelectContentAdapter).list.size) {
//                    mRecyclerView.scrollToPosition(position)
//                    val mLayoutManager = mRecyclerView.layoutManager as LinearLayoutManager
//                    mLayoutManager.scrollToPositionWithOffset(position, 0)
//                }
//            }
//        })
    }
}
